-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add to_str for hashmap. #2899
Add to_str for hashmap. #2899
Conversation
This change shouldn't change the memory layout of hashmaps, because type synonyms get treated as if they've been expanded. If it does change the layout, that would be a pre-existing bug in the compiler. I agree unifying "%?" with I'll try to merge this. |
Oh, and happily, the refactor you did was independently made anyway by Patrick, to make the coherence checker happy (except the inner type is called |
Having trouble merging this. I think it might be a resolve bug. I'll look at it later on. |
Integrated in 28519c8, thanks. |
Cool, np. |
Update RLS and Rustfmt RLS * Allow project model to download crates ([#1020](rust-lang/rls#1020)) * Support simple external builds ([#988](rust-lang/rls#988)) * Support using external Rustfmt ([#990](rust-lang/rls#990)) Rustfmt (0.99.4) * Format chains with comment ([#2899](https://github.com/rust-lang-nursery/rls/pull/2899)) * Do not show wildcard pattern in slice pattern ([#2912](https://github.com/rust-lang-nursery/rls/pull/2912)) * Impl only use ([#2951](https://github.com/rust-lang-nursery/rls/pull/2951)) * ... and [more](rust-lang/rustfmt@5c9a2b6...1c40881) Bumped in tandem to pull a single version of `rustc-ap-*` libs. r? @nrc
Try to ensure measureme output is valid when the interpreter is interrupted Dropping our `measureme::Profiler` will have the profiler flush its output buffer and write out its string table. If the profiler's `Drop` impl does not run, the output file is not usable. This approach has zero runtime overhead.
Resolves: rust-lang#2714 Co-authored-by: Ted Kaminski <tedinski@amazon.com>
Fixes #2566.
I had to do a bit of refactoring to make this work, because there is already a to_str instance for \forall T.@t, and hashmap has type @{...}, so I couldn't make a to_str instance for hashmap. Instead, I factored out the raw record type as "inner", and put the to_str instance on that. This required moving the private helper methods onto inner as well, which I guess works fine because of magical auto-dereferencing when calling them.
The thing I most worry about is that I have somehow changed the memory layout / behavior of hashmaps by doing this, but I don't think so.
There seems to be an aesthetic choice here between calling to_str on the keys and values, versus printing them with "%?". I chose the former as more consistent, but the latter produces slightly more useful output (printing strings quoted, e.g.) It seems like there should be a more unified notion of how to print things, somehow. Shouldn't "%?" be using the to_str iface, where present? Is there some iface it does use?
[Oh, and the actual printing code, which was the least trouble in this whole exercise, is stolen from the json module, which is why it uses a writer. I could do something else if it would be more idiomatic.]